1. /* sdmsetsl.cpp by K.Tsuru */
  2. // function ID = 304 DRADIX only
  3. /**********************
  4. SDouble class
  5. It sets a SLong value.
  6. **********************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. void SDouble::SetSLong(const SLong& m){
  11. //check the radix
  12. if(m.Type() != DEC_INT) m.SetError(m.RADIX_ERR, "SL-->SD", 304);
  13. if( m.Sign(304) == 0 ){ SetZero(); return; }
  14. uint mh1 = m.Head()+1;
  15. uint sz = mh1 - m.Tail()+1; //+1 for figure[0] = 0
  16. // mh1 < INTDEX_MAX = INT_MAX
  17. rdxExp = (int)mh1; //exponent
  18. sz = min(sz, MaxSize());
  19. valloc(sz, -1); //When sz>MaxSize(), the lower part is neglected.
  20. #ifndef NDEBUG
  21. m.figure(mh1-1);
  22. figure(sz-1);
  23. m.figure(mh1-sz+1);
  24. #endif
  25. register uint i;
  26. fType *v = figure.Elements();
  27. const fType* mv = m.ReadFigures();
  28. for(i = 1; i < sz ; i++) v[i] = mv[mh1-i];
  29. v[0] = 0; figure.clear(sz);
  30. aHead = sz-1;
  31. while(!v[aHead]) aHead--;
  32. aTail = 0;
  33. while(!v[aTail]) aTail++;
  34. SetSign(m.Sign(304));
  35. Reform(304);
  36. }

sdmsetsl.cpp : last modifiled at 2017/03/17 11:10:45(994 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).